package com.mdxl.second.util;

import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

import java.io.Serializable;

public class PageUtil implements Serializable,Pageable {
    private static final long seriaVersionUID =1L;
    //当前页
    private Integer pageNum =1;
    //当前页面数
    private Integer pagesize =2;
    //排序条件
    private Sort sort;
    @Override
    public int getPageNumber() {
        return pageNum;
    }

    @Override
    public int getPageSize() {
        return pagesize;
    }
    //第二页所需增加的数量
    @Override
    public int getOffset() {
        return (getPageNumber()-1)*pagesize;
    }

    @Override
    public Sort getSort() {
        return sort;
    }
    public void setSort(Sort sort){
        this.sort =sort;
    }

    @Override
    public Pageable next() {
        return null;
    }

    @Override
    public Pageable previousOrFirst() {
        return null;
    }

    @Override
    public Pageable first() {
        return null;
    }

    @Override
    public boolean hasPrevious() {
        return false;
    }
    public int getPageNum(){
        return pageNum;
    }
    public void setPageNum(int pageNum){
        this.pageNum =pageNum;
    }
    public int getPagesize(){
        return pagesize;
    }
    public void setPagesize(int pagesize){
        this.pagesize =pagesize;
    }


}
